<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="../Styles/style.css" rel="stylesheet" type="text/css"/>


</head>

<body>
<div class="article-body">
    <div class="article-intro">

        <h1>Java String 类</h1>
        <p>
            字符串广泛应用 在Java 编程中，在 Java 中字符串属于对象，Java 提供了 String 类来创建和操作字符串。
        </p><hr>
        <h2>创建字符串</h2>
        <p>创建字符串最简单的方式如下:</p>
        <div class="example">
            <div class="example_code">
                <div class="hl-main"><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">greeting</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-string">菜鸟教程</span><span class="hl-quotes">"</span><span class="hl-code">;</span></div>
            </div>
        </div>
        <p>
            在代码中遇到字符串常量时，这里的值是 "<strong>菜鸟教程</strong>""，编译器会使用该值创建一个 String 对象。
        </p><p>和其它对象一样，可以使用关键字和构造方法来创建 String 对象。
    </p><p>String 类有 11 种构造方法，这些方法提供不同的参数来初始化字符串，比如提供一个字符数组参数:</p>
        <div class="example">
            <h2 class="example">StringDemo.java 文件代码：</h2>
            <div class="example_code">
                <div class="hl-main"><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-reserved">class</span><span class="hl-code"> </span><span class="hl-identifier">StringDemo</span><span class="hl-brackets">{</span><span class="hl-code">
   </span><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-types">static</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">main</span><span class="hl-brackets">(</span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">args</span><span class="hl-brackets">[</span><span class="hl-brackets">]</span><span class="hl-brackets">)</span><span class="hl-brackets">{</span><span class="hl-code">
      </span><span class="hl-types">char</span><span class="hl-brackets">[</span><span class="hl-brackets">]</span><span class="hl-code"> </span><span class="hl-identifier">helloArray</span><span class="hl-code"> = </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-quotes">'</span><span class="hl-string">r</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">u</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">n</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">o</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">o</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">b</span><span class="hl-quotes">'</span><span class="hl-brackets">}</span><span class="hl-code">;
      </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">helloString</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-brackets">(</span><span class="hl-identifier">helloArray</span><span class="hl-brackets">)</span><span class="hl-code">;
      </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">println</span><span class="hl-brackets">(</span><span class="hl-code"> </span><span class="hl-identifier">helloString</span><span class="hl-code"> </span><span class="hl-brackets">)</span><span class="hl-code">;
   </span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-brackets">}</span></div>
            </div>
        </div>
        <p>以上实例编译运行结果如下：</p>
        <pre class="prettyprint">runoob
</pre>
        <p>
            <strong>注意:</strong>String 类是不可改变的，所以你一旦创建了 String 对象，那它的值就无法改变了（详看笔记部分解析）。</p><p>
        如果需要对字符串做很多修改，那么应该选择使用 <a href="/java/java-stringbuffer.html" target="_blank" title="StringBuffer &amp; StringBuilder 类">StringBuffer &amp; StringBuilder 类</a>。
    </p><hr>
        <h2>字符串长度</h2>
        <p>
        </p><p>用于获取有关对象的信息的方法称为访问器方法。
    </p><p>String 类的一个访问器方法是 length() 方法，它返回字符串对象包含的字符数。
    </p><p>下面的代码执行后，len变量等于14:</p>
        <div class="example">
            <h2 class="example">StringDemo.java 文件代码：</h2>
            <div class="example_code">
                <div class="hl-main"><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-reserved">class</span><span class="hl-code"> </span><span class="hl-identifier">StringDemo</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-types">static</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">main</span><span class="hl-brackets">(</span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">args</span><span class="hl-brackets">[</span><span class="hl-brackets">]</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
        </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">site</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-string">www.runoob.com</span><span class="hl-quotes">"</span><span class="hl-code">;
        </span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">len</span><span class="hl-code"> = </span><span class="hl-identifier">site</span><span class="hl-code">.</span><span class="hl-identifier">length</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
        </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">println</span><span class="hl-brackets">(</span><span class="hl-code"> </span><span class="hl-quotes">"</span><span class="hl-string">菜鸟教程网址长度 : </span><span class="hl-quotes">"</span><span class="hl-code"> + </span><span class="hl-identifier">len</span><span class="hl-code"> </span><span class="hl-brackets">)</span><span class="hl-code">;
   </span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-brackets">}</span></div>
            </div>
        </div>
        <p>以上实例编译运行结果如下：</p>
        <pre class="prettyprint">菜鸟教程网址长度 : 14
</pre><hr>
        <h2>连接字符串</h2>
        <p>String 类提供了连接两个字符串的方法：</p>
        <div class="example">
            <div class="example_code">
                <div class="hl-main"><span class="hl-identifier">string1</span><span class="hl-code">.</span><span class="hl-identifier">concat</span><span class="hl-brackets">(</span><span class="hl-identifier">string2</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
            </div>
        </div>
        <p>
            返回 string2 连接 string1 的新字符串。也可以对字符串常量使用 concat() 方法，如：
        </p>
        <pre class="prettyprint">"我的名字是 ".concat("Runoob");</pre>
        <p>
            更常用的是使用'+'操作符来连接字符串，如：</p>
        <pre class="prettyprint">"Hello," + " runoob" + "!"</pre>
        <p>
            结果如下:</p>
        <pre class="prettyprint">"Hello, runoob!"</pre>
        <p>
            下面是一个例子:</p>
        <div class="example">
            <h2 class="example">StringDemo.java 文件代码：</h2>
            <div class="example_code">
                <div class="hl-main"><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-reserved">class</span><span class="hl-code"> </span><span class="hl-identifier">StringDemo</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-types">static</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">main</span><span class="hl-brackets">(</span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">args</span><span class="hl-brackets">[</span><span class="hl-brackets">]</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
        </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">string1</span><span class="hl-code"> = </span><span class="hl-quotes">"</span><span class="hl-string">菜鸟教程网址：</span><span class="hl-quotes">"</span><span class="hl-code">;
        </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">println</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">1、</span><span class="hl-quotes">"</span><span class="hl-code"> + </span><span class="hl-identifier">string1</span><span class="hl-code"> + </span><span class="hl-quotes">"</span><span class="hl-string">www.runoob.com</span><span class="hl-quotes">"</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-brackets">}</span></div>
            </div>
        </div>
        <p>以上实例编译运行结果如下：</p>
        <pre class="prettyprint">1、菜鸟教程网址：www.runoob.com
</pre>
        <hr>
        <h2>创建格式化字符串</h2>
        <p>我们知道输出格式化数字可以使用 printf() 和 format() 方法。</p><p>String 类使用静态方法 format() 返回一个String 对象而不是 PrintStream 对象。
    </p><p>String 类的静态方法 format() 能用来创建可复用的格式化字符串，而不仅仅是用于一次打印输出。</p><p>如下所示：
    </p>
        <div class="example">
            <div class="example_code">
                <div class="hl-main"><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">浮点型变量的值为 </span><span class="hl-quotes">"</span><span class="hl-code"> +
                  </span><span class="hl-quotes">"</span><span class="hl-string">%f, 整型变量的值为 </span><span class="hl-quotes">"</span><span class="hl-code"> +
                  </span><span class="hl-quotes">"</span><span class="hl-string"> %d, 字符串变量的值为 </span><span class="hl-quotes">"</span><span class="hl-code"> +
                  </span><span class="hl-quotes">"</span><span class="hl-string">is %s</span><span class="hl-quotes">"</span><span class="hl-code">, </span><span class="hl-identifier">floatVar</span><span class="hl-code">, </span><span class="hl-identifier">intVar</span><span class="hl-code">, </span><span class="hl-identifier">stringVar</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
            </div>
        </div>
        <p>你也可以这样写</p>
        <div class="example">
            <div class="example_code">
                <div class="hl-main"><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">fs</span><span class="hl-code">;
</span><span class="hl-identifier">fs</span><span class="hl-code"> = </span><span class="hl-identifier">String</span><span class="hl-code">.</span><span class="hl-identifier">format</span><span class="hl-brackets">(</span><span class="hl-quotes">"</span><span class="hl-string">浮点型变量的值为 </span><span class="hl-quotes">"</span><span class="hl-code"> +
                   </span><span class="hl-quotes">"</span><span class="hl-string">%f, 整型变量的值为 </span><span class="hl-quotes">"</span><span class="hl-code"> +
                   </span><span class="hl-quotes">"</span><span class="hl-string"> %d, 字符串变量的值为 </span><span class="hl-quotes">"</span><span class="hl-code"> +
                   </span><span class="hl-quotes">"</span><span class="hl-string"> %s</span><span class="hl-quotes">"</span><span class="hl-code">, </span><span class="hl-identifier">floatVar</span><span class="hl-code">, </span><span class="hl-identifier">intVar</span><span class="hl-code">, </span><span class="hl-identifier">stringVar</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
            </div>
        </div>
        <hr>
        <h2>String 方法</h2>
        <p>下面是 String 类支持的方法，更多详细，参看 <a href="http://www.runoob.com/manual/jdk1.6/java/lang/String.html" target="_blank">Java String API</a> 文档:</p>
        <table class="reference">
            <tbody>
            <tr>
                <th style="width:76px;">
                    SN(序号)</th>
                <th style="width:501px;">
                    方法描述</th>
            </tr>
            <tr>
                <td style="width:76px;">
                    1</td>
                <td style="width:501px;">
                    <a href="java-string-charat.html" target="_blank">char charAt(int index)</a><br>
                    返回指定索引处的 char 值。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    2</td>
                <td style="width:501px;">
                    <a href="java-string-compareto.html" target="_blank">int compareTo(Object o)</a><br>
                    把这个字符串和另一个对象比较。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    3</td>
                <td style="width:501px;">
                    <a href="java-string-compareto.html" target="_blank">int compareTo(String anotherString)</a><br>
                    按字典顺序比较两个字符串。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    4</td>
                <td style="width:501px;">
                    <a href="java-string-comparetoignorecase.html" target="_blank">int compareToIgnoreCase(String str)</a><br>
                    按字典顺序比较两个字符串，不考虑大小写。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    5</td>
                <td style="width:501px;">
                    <a href="java-string-concat.html" target="_blank">String concat(String str)</a><br>
                    将指定字符串连接到此字符串的结尾。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    6</td>
                <td style="width:501px;">
                    <a href="java-string-contentequals.html" target="_blank">boolean contentEquals(StringBuffer sb)</a><br>
                    当且仅当字符串与指定的StringButter有相同顺序的字符时候返回真。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    7</td>
                <td style="width:501px;">
                    <a href="java-string-copyvalueof.html" target="_blank">static String copyValueOf(char[] data)</a><br>
                    返回指定数组中表示该字符序列的 String。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    8</td>
                <td style="width:501px;">
                    <a href="java-string-copyvalueof.html" target="_blank">static String copyValueOf(char[] data, int offset, int count)</a><br>
                    返回指定数组中表示该字符序列的 String。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    9</td>
                <td style="width:501px;">
                    <a href="java-string-endswith.html" target="_blank">boolean endsWith(String suffix)</a><br>
                    测试此字符串是否以指定的后缀结束。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    10</td>
                <td style="width:501px;">
                    <a href="java-string-equals.html" target="_blank">boolean equals(Object anObject)</a><br>
                    将此字符串与指定的对象比较。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    11</td>
                <td style="width:501px;">
                    <a href="java-string-equalsignorecase.html" target="_blank">boolean equalsIgnoreCase(String anotherString)</a><br>
                    将此 String 与另一个 String 比较，不考虑大小写。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    12</td>
                <td style="width:501px;">
                    <a href="java-string-getbytes.html" target="_blank">byte[] getBytes()</a><br>
                    &nbsp;使用平台的默认字符集将此 String 编码为 byte 序列，并将结果存储到一个新的 byte 数组中。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    13</td>
                <td style="width:501px;">
                    <a href="java-string-getbytes.html" target="_blank">byte[] getBytes(String charsetName)</a><br>
                    使用指定的字符集将此 String 编码为 byte 序列，并将结果存储到一个新的 byte 数组中。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    14</td>
                <td style="width:501px;">
                    <a href="java-string-getchars.html" target="_blank">void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)</a><br>
                    将字符从此字符串复制到目标字符数组。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    15</td>
                <td style="width:501px;">
                    <a href="java-string-hashcode.html" target="_blank">int hashCode()</a><br>
                    返回此字符串的哈希码。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    16</td>
                <td style="width:501px;">
                    <a href="java-string-indexof.html" target="_blank">int indexOf(int ch)</a><br>
                    返回指定字符在此字符串中第一次出现处的索引。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    17</td>
                <td style="width:501px;">
                    <a href="java-string-indexof.html" target="_blank">int indexOf(int ch, int fromIndex)</a><br>
                    返回在此字符串中第一次出现指定字符处的索引，从指定的索引开始搜索。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    18</td>
                <td style="width:501px;">
                    <a href="java-string-indexof.html" target="_blank">int indexOf(String str)</a><br>
                    &nbsp;返回指定子字符串在此字符串中第一次出现处的索引。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    19</td>
                <td style="width:501px;">
                    <a href="java-string-indexof.html" target="_blank">int indexOf(String str, int fromIndex)</a><br>
                    返回指定子字符串在此字符串中第一次出现处的索引，从指定的索引开始。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    20</td>
                <td style="width:501px;">
                    <a href="java-string-intern.html" target="_blank">String intern()</a><br>
                    &nbsp;返回字符串对象的规范化表示形式。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    21</td>
                <td style="width:501px;">
                    <a href="java-string-lastindexof.html" target="_blank">int lastIndexOf(int ch)</a><br>
                    &nbsp;返回指定字符在此字符串中最后一次出现处的索引。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    22</td>
                <td style="width:501px;">
                    <a href="java-string-lastindexof.html" target="_blank">int lastIndexOf(int ch, int fromIndex)</a><br>
                    返回指定字符在此字符串中最后一次出现处的索引，从指定的索引处开始进行反向搜索。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    23</td>
                <td style="width:501px;">
                    <a href="java-string-lastindexof.html" target="_blank">int lastIndexOf(String str)</a><br>
                    返回指定子字符串在此字符串中最右边出现处的索引。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    24</td>
                <td style="width:501px;">
                    <a href="java-string-lastindexof.html" target="_blank">int lastIndexOf(String str, int fromIndex)</a><br>
                    &nbsp;返回指定子字符串在此字符串中最后一次出现处的索引，从指定的索引开始反向搜索。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    25</td>
                <td style="width:501px;">
                    <a href="java-string-length.html" target="_blank">int length()</a><br>
                    返回此字符串的长度。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    26</td>
                <td style="width:501px;">
                    <a href="java-string-matches.html" target="_blank">boolean matches(String regex)</a><br>
                    告知此字符串是否匹配给定的正则表达式。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    27</td>
                <td style="width:501px;">
                    <a href="java-string-regionmatches.html" target="_blank">boolean regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)</a><br>
                    测试两个字符串区域是否相等。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    28</td>
                <td style="width:501px;">
                    <a href="java-string-regionmatches.html" target="_blank">boolean regionMatches(int toffset, String other, int ooffset, int len)</a><br>
                    测试两个字符串区域是否相等。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    29</td>
                <td style="width:501px;">
                    <a href="java-string-replace.html" target="_blank">String replace(char oldChar, char newChar)</a><br>
                    返回一个新的字符串，它是通过用 newChar 替换此字符串中出现的所有 oldChar 得到的。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    30</td>
                <td style="width:501px;">
                    <a href="java-string-replaceall.html" target="_blank">String replaceAll(String regex, String replacement</a><br>
                    使用给定的 replacement 替换此字符串所有匹配给定的正则表达式的子字符串。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    31</td>
                <td style="width:501px;">
                    <a href="java-string-replacefirst.html" target="_blank">String replaceFirst(String regex, String replacement)</a><br>
                    &nbsp;使用给定的 replacement 替换此字符串匹配给定的正则表达式的第一个子字符串。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    32</td>
                <td style="width:501px;">
                    <a href="java-string-split.html" target="_blank">String[] split(String regex)</a><br>
                    根据给定正则表达式的匹配拆分此字符串。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    33</td>
                <td style="width:501px;">
                    <a href="java-string-split.html" target="_blank">String[] split(String regex, int limit)</a><br>
                    根据匹配给定的正则表达式来拆分此字符串。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    34</td>
                <td style="width:501px;">
                    <a href="java-string-startswith.html" target="_blank">boolean startsWith(String prefix)</a><br>
                    测试此字符串是否以指定的前缀开始。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    35</td>
                <td style="width:501px;">
                    <a href="java-string-startswith.html" target="_blank">boolean startsWith(String prefix, int toffset)</a><br>
                    测试此字符串从指定索引开始的子字符串是否以指定前缀开始。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    36</td>
                <td style="width:501px;">
                    <a href="java-string-subsequence.html" target="_blank">CharSequence subSequence(int beginIndex, int endIndex)</a><br>
                    &nbsp;返回一个新的字符序列，它是此序列的一个子序列。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    37</td>
                <td style="width:501px;">
                    <a href="java-string-substring.html" target="_blank">String substring(int beginIndex)</a><br>
                    返回一个新的字符串，它是此字符串的一个子字符串。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    38</td>
                <td style="width:501px;">
                    <a href="java-string-substring.html" target="_blank">String substring(int beginIndex, int endIndex)</a><br>
                    返回一个新字符串，它是此字符串的一个子字符串。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    39</td>
                <td style="width:501px;">
                    <a href="java-string-tochararray.html" target="_blank">char[] toCharArray()</a><br>
                    将此字符串转换为一个新的字符数组。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    40</td>
                <td style="width:501px;">
                    <a href="java-string-tolowercase.html" target="_blank">String toLowerCase()</a><br>
                    使用默认语言环境的规则将此 String 中的所有字符都转换为小写。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    41</td>
                <td style="width:501px;">
                    <a href="java-string-tolowercase.html" target="_blank">String toLowerCase(Locale locale)</a><br>
                    &nbsp;使用给定 Locale 的规则将此 String 中的所有字符都转换为小写。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    42</td>
                <td style="width:501px;">
                    <a href="java-string-tostring.html" target="_blank">String toString()</a><br>
                    &nbsp;返回此对象本身（它已经是一个字符串！）。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    43</td>
                <td style="width:501px;">
                    <a href="java-string-touppercase.html" target="_blank">String toUpperCase()</a><br>
                    使用默认语言环境的规则将此 String 中的所有字符都转换为大写。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    44</td>
                <td style="width:501px;">
                    <a href="java-string-touppercase.html" target="_blank">String toUpperCase(Locale locale)</a><br>
                    使用给定 Locale 的规则将此 String 中的所有字符都转换为大写。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    45</td>
                <td style="width:501px;">
                    <a href="java-string-trim.html" target="_blank">String trim()</a><br>
                    返回字符串的副本，忽略前导空白和尾部空白。</td>
            </tr>
            <tr>
                <td style="width:76px;">
                    46</td>
                <td style="width:501px;">
                    <a href="java-string-valueof.html" target="_blank">static String valueOf(primitive data type x)</a><br>
                    返回给定data type类型x参数的字符串表示形式。</td>
            </tr>
            </tbody>
        </table>

    </div>
</div>
</body>
</html>
